#ifndef NODE_HH
#define NODE_HH

#include <QColor>
#include <QObject>
#include <QList>

namespace dsa
{


class Node : public QObject
{
	Q_OBJECT
public:
	enum Type
	{
		Type_File,
    Type_Dir,
    Type_Dummy
	};

private:
	qint64				_size;
	QString				_name;
	Type					_type;

	qint64				_numFiles;
	qint64				_numDirs;

	Node					*_parent;
	QList<Node*>	_children;

	static QString TypeString (Type type);

  bool          _hover;
  QColor        _color;
protected:
	Node(Type type);

public:
	~Node ();

	Type GetType () const;

	void SetSize (qint64 size);
	qint64 GetSize () const;

	static QString GetSizeString (qint64 size);

	void SetName (const QString& name);
	const QString& GetName () const;

	QString GetFullName () const;

	void AddNode (Node* node);
	void RemoveNode (Node* node);

	void EvalData ();

  dsa::Node* GetParent () { return _parent; }
  virtual qint64 GetNumberOfChildren () const { return _children.size(); }
  dsa::Node* GetChild(qint64 idx) { return _children[idx]; }

	virtual qint64 GetNumberOfFiles () const { return _numFiles; }
	virtual qint64 GetNumberOfDirs () const { return _numDirs; }

	void Debug (int indent = 0);
  bool IsHover () const;

  void SetColor (const QColor& color) { _color = color; }
  const QColor& GetColor () const { return _color; }
	
public slots:
  void ChangeHover (bool hover);

signals:
  void HoverChanged (bool hover);
	
	
};

class FileNode : public Node
{
public:
	FileNode ();

	qint64 GetNumberOfFiles() const { return 1; }
};


class DirNode : public Node
{
public:
	DirNode ();
};

class DummyNode : public Node
{
public:
  DummyNode ();

};

}

#endif // NODE_HH
